package com.kuaizu.es.mqbuis;

import com.kuaizu.es.buis.imp.ProjectBusinessService;
import kuaizu.common.mqconst.MQConstant;
import kuaizu.common.tablepojo.Project;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author: wangmx15
 * @date: 2025/8/23
 **/
@Component
@Log4j2
public class ReceiveMessages {
    @Autowired
    private ProjectBusinessService projectBusinessService;
    @RabbitListener(queues = MQConstant.CREATE_PROJECT_QUEUE)
    public void sendProjectMessageDlx(Project project) {
        //将接收到的json对
        //接受到的对象
        log.info("接受创建项目的消息：{}",project);
        //接受创建项目的消息
        projectBusinessService.addData(project);
    }

    @RabbitListener(queues = MQConstant.DELECT_PROJECT_QUEUE)
    public void sendProjectMessage(Integer id) {
        log.info("接受删除项目的消息：{}",id);
        projectBusinessService.deleteProject(id);
    }

    @RabbitListener(queues = "duil")
    public void tes(String massage) {
        log.info("测试能接受消息???->：{}",massage);
    }
}
